package com.tjetc.file;

import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;

@SuppressWarnings("all")
public class _1File {
    /*
           文件的相关操作
               new File(String pathname)            //根据路径构建⼀个File对象 （一般情况使用这种）
               new File(File parent,String child)   //根据⽗⽬录⽂件+⼦路径构建
               new File(String parent,String child) //根据⽗⽬录+⼦路径构建
               createNewFile //创建新⽂件
           相对路径：从自己的路径开始找
           绝对路径：从盘符开始找
        */

    @Test
    public void testCreateFile() throws IOException {
        File file = new File("/Users/gaoyongxiang/百度网盘/IDEA-Java/202507-java-se/chapter16/1.txt");
        file.createNewFile();
    }

    @Test
    public void testCreateFile1() throws IOException {
        File file = new File("/Users/gaoyongxiang/百度网盘/IDEA-Java/202507-java-se/chapter16/", "2.txt");
        file.createNewFile();
    }

    @Test
    public void testCreateFile2() throws IOException {
        File file = new File("/Users/gaoyongxiang/百度网盘/IDEA-Java/202507-java-se/chapter16");
        File file1 = new File(file, "3.txt");
        file1.createNewFile();
    }



}
